package cn.edu.nyist.integration.exception;

import cn.edu.nyist.integration.common.ResponseCode;
import cn.edu.nyist.integration.common.ServerResponse;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.thymeleaf.exceptions.TemplateInputException;

@ControllerAdvice(assignableTypes = {Exception.class})
public class GlobalExceptionHandler extends RuntimeException {

    public GlobalExceptionHandler() {
        super();
    }


    @ExceptionHandler(TemplateInputException.class)
    public ServerResponse handleThyemeleafException(){
        return ServerResponse.createByErrorCodeMessage(ResponseCode.LOGIN_EXPIRE.getCode(),"会话超时请重新登陆");
    }


}
